package nc.bs.pub.action;

import nc.bs.pubapp.pf.action.AbstractPfAction;
import nc.bs.so.syncest.ace.bp.AceSyncestApproveBP;
import nc.bs.so.syncest.plugin.bpplugin.SyncestPluginPoint;
import nc.impl.pubapp.pattern.rule.processer.CompareAroundProcesser;
import nc.vo.pub.VOStatus;
import nc.vo.so.syncest.AggEasSyncestVO;
import nc.impl.pubapp.pattern.rule.IRule;
import nc.vo.pub.BusinessException;
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
import nc.bs.framework.common.NCLocator;

public class N_ZH55_APPROVE extends AbstractPfAction<AggEasSyncestVO> {

  public N_ZH55_APPROVE() {
    super();
  }

  @Override
  protected CompareAroundProcesser<AggEasSyncestVO> getCompareAroundProcesserWithRules(
      Object userObj) {
    CompareAroundProcesser<AggEasSyncestVO> processor =
        new CompareAroundProcesser<AggEasSyncestVO>(
            SyncestPluginPoint.APPROVE);
    IRule<AggEasSyncestVO> rule=null;
				  				   				     rule = new nc.bs.pubapp.pub.rule.ApproveStatusCheckRule();
				   				   				    				   				   
				   				     processor.addBeforeRule(rule);
				   				   
  
				      return processor;
  }

  @Override
  protected AggEasSyncestVO[] processBP(Object userObj,
      AggEasSyncestVO[] clientFullVOs, AggEasSyncestVO[] originBills) {
    AggEasSyncestVO[] bills = null;
		      nc.itf.so.ISyncestMaintain operator = NCLocator.getInstance().lookup(nc.itf.so.ISyncestMaintain.class);
      try {
          bills=operator.approve(clientFullVOs,originBills);
      } catch (BusinessException e) {
				          ExceptionUtils.wrappBusinessException(e.getMessage());
			      }
    return bills;
  }

}
